package com.ruoyi.project.newhope.warning.mapper;

import com.ruoyi.project.newhope.warning.domain.NewHopeWarning;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

/**
 * 报警记录Mapper接口
 * 
 * @author ruoyi
 * @date 2021-02-08
 */
public interface NewHopeWarningMapper
{
    /**
     * 查询报警记录
     *
     * @param id 报警记录ID
     * @return 报警记录
     */
    public NewHopeWarning selectNewHopeWarningById(Long id);

    /**
     * 查询报警记录列表
     *
     * @param newHopeWarning 报警记录
     * @return 报警记录集合
     */
    public List<NewHopeWarning> selectNewHopeWarningList(NewHopeWarning newHopeWarning);

    /**
     * 新增报警记录
     *
     * @param newHopeWarning 报警记录
     * @return 结果
     */
    public int insertNewHopeWarning(NewHopeWarning newHopeWarning);

    /**
     * 修改报警记录
     *
     * @param newHopeWarning 报警记录
     * @return 结果
     */
    public int updateNewHopeWarning(NewHopeWarning newHopeWarning);

    /**
     * 删除报警记录
     *
     * @param id 报警记录ID
     * @return 结果
     */
    public int deleteNewHopeWarningById(Long id);

    /**
     * 批量删除报警记录
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    public int deleteNewHopeWarningByIds(String[] ids);

    List<NewHopeWarning> selectNewHopeWarningByInspectionId(@Param("inspectionId") Long inspectionId);

    NewHopeWarning selectNewHopeWarningOne();

    Integer updateNewHopeWarningSwitchByInspectionId(@Param("inspectionId") Long inspectionId, @Param("stepSwitch") Boolean stepSwitch);

    NewHopeWarning selectNewHopeWarningIsExist(NewHopeWarning newHopeWarning);

    Integer deleteNewHopeWarning(@Param("infraredDeviceId") Long deviceId, @Param("materialId") Long materialId, @Param("inspectionId") Long inspectionId);

    Integer clearWarningByMaterialCode(String materialCode);

    @Select("select * from new_hope_warning where create_time <= #{targetDate}")
    List<NewHopeWarning> selectDataByDate(Date targetDate);

    @Delete("delete from new_hope_warning where create_time <= #{targetDate}")
    Integer deleteDataByDate(Date targetDate);

    Integer batchBackInsert(List<NewHopeWarning> data);

    Integer insertBackup(NewHopeWarning warning);
}
